/**
 * Created by wyy on 17-7-18.
 */
angular.module('apartmentDelect', []).component(
    'apartmentDelect',
    {
        templateUrl: 'component/apartmentInfo/apartmentDelect/apartment_delect.template.html',
        controller: [
            '$scope', 'Api','Alert', '$state',

            function ($scope, Api,Alert, $state) {
            $scope.submitreturn=submitreturn;

            $scope.submitDelectApament=submitDelectApament
                function submitDelectApament() {
                    if ($scope.confirmSelectNum !==$scope.$parent.ApamentListInfo.num) {
                        Alert.alertBox('输入的房源编号不正确');
                    } else {
                        callDeleteApament();
                    }
                }
                function callDeleteApament() {

                Api.deleteApartmentInfo($scope.$parent.ApamentListInfo.id, function (result) {
                        Alert.alertBox('删除成功',function () {
                          $state.go('company.companyApartmentManage');
                        });
                    });


                }
                function submitreturn() {
                $scope.apartmentInfoController=true;

                }

            }
        ]
    }
);